Overview of IDL Keyword Processing

IDL keyword processing can seem confusing at first glance, due to the interrelated data structures involved. However, as the examples that follow in this section will show, the concepts involved are relatively straightforward once you have seen and understood a concrete example such as Keyword Examples.

Following is a skeleton of a system routine that accepts keyword arguments. These elements must be present in any such system routine:

void keyword_sysrtn_skeleton(int argc, IDL_VPTR *argv, char *argk)

{

typedef struct {

IDL_KW_RESULT_FIRST_FIELD; /* Must be first entry in struct */

... /* Variables specific to your keywords go here */

} KW_RESULT;

static IDL_KW_PAR kw_pars[] = {

 

/*

* Keyword definitions for the keywords you accept go here,

* one definition per keyword. The keyword definitions refer

* to fields within the KW_RESULT type defined above.

*/

...

 

{ NULL } /* List must be NULL terminated */

 

};

KW_RESULT kw; /* Variable which will hold the keyword values */

 

(void) IDL_KWProcessByOffset(argc, argv, argk, kw_pars,

   (IDL_VPTR *) 0, 1, &kw);

/* The body of your routine */

 

IDL_KW_FREE;

}

IDL keyword processing is made up of the following data structures and steps: